//创建一个路由器，并暴露出去

//第一步：引入createRouter
import {createRouter,createWebHistory } from "vue-router";
 //第二步：引入一个一个可能要呈现的组件
 import discover from '@/router/discover.vue';
 import release from '@/router/release.vue';
 import notice from '@/router/notice.vue';

 import more from '@/router/more.vue';
 import detail from '@/router/detail.vue';
 import comments from '@/router/notice/comments.vue';
 
 //第二部：创建路由器
 const router = createRouter({
    history:createWebHistory(),//路由器的工作模式
    routes:[//路由规则
        {
            path:'/', 
            redirect:'/discover'
        },
        {
            path:'/discover',
            component:discover,
            children:[
                       
                {
                    path:'detail', //子集路由不需要加路径
                    component:detail
                }
            ]
           
        },
        {
            path:'/release',
            component:release
        },
        {
            path:'/notice',
            component:notice,
            children:[
                {
                    path:'comments',
                    component:comments
                },
                {
                    path: "likes",
                    name: "LikesPage",
                    component: () => import("@/router/notice/likes.vue"),
                },
                {
                    path: "follow",
                    name: "FollowPage",
                    component: () => import("@/router/notice/follow.vue"),
                },
                {
                    path: "",
                    name: "DefaultCommentsPage",
                    component: () => import("@/router/notice/comments.vue"),
                },
            ]
        },
        {
            path: '/myself', // 我的
            name: 'myself',
            component: () => import('../router/myself/myself.vue'),
            children: [
                {
                    path: '',
                    name: 'NotePage', // 默认子路由
                    component: () => import('../router/myself/note.vue')
                },
                {
                    path: 'note',
                    name: 'note',
                    component: () => import('../router/myself/note.vue')
                },
                {
                    path: 'good',
                    name: 'good',
                    component: () => import('../router/myself/good.vue')
                },
                {
                    path: 'collection',
                    name: 'collection',
                    component: () => import('../router/myself/collection.vue'),
                    children: [
                        {
                            path: 'notes',
                            name: 'CollectionNotesPage',
                            component: () => import('../router/myself/collection/notes.vue')
                        },
                        {
                            path: 'zhuanji',
                            name: 'ZhuanjiPage',
                            component: () => import('../router/myself/collection/zhuanji.vue')
                        },
                        {
                            path: '',
                            name: 'CollectionDefaultNotesPage',
                            component: () => import('../router/myself/collection/notes.vue')
                        }
                    ]
                }
            ]
        },
        {
            path: '/more',
            component: more
        },
    ]
});     

 //把路由暴露出去
 export default router